package subjectAndProfessorship;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import java.util.LinkedList;
import java.util.List;

import junit.framework.Assert;
import junit.framework.TestCase;
import practicalWork.PracticalWork;
import studentsAndDocentWithTutorship.Docent;
import studentsAndDocentWithTutorship.Instructor;
import test.MydTerm;
import util.MyDate;

public class testProfessorhip extends TestCase{
	private Professorship objetos2; 
	private Docent responsable, jefeTP; 
	private Subject materia; 
	private MyDate inicio, fin; 
	private List<SettingProfessorship>hsDeClase= new LinkedList<SettingProfessorship>(); 

	public void setUp (){
		SettingProfessorship mierc = mock (SettingProfessorship.class);
		this.hsDeClase.add(mierc); 
		this.responsable = mock(Docent.class); 
		this.jefeTP = mock(Docent.class); 
		this.materia = mock (Subject.class); 
		this.inicio = mock (MyDate.class); 
		this.fin = mock (MyDate.class); 
		
		this.objetos2 = new Professorship(responsable, jefeTP, 14, 15, hsDeClase, inicio, fin);
	}
	
	public void testAddCollaborator(){
		Instructor guido = mock (Instructor.class); 
		this.objetos2.addCollaborator(guido); 
		Assert.assertEquals(this.objetos2.getCollaborators().size(), 1);
	}
	
	public void testMejorPuntuacionDeUnTP(){
		PracticalWork pw = mock (PracticalWork.class); 
		this.objetos2.addPracticalWork(pw); 
		
		when(pw.bestScoreIn()).thenReturn(10);
		this.objetos2.mejorPuntuacionDeUnTP(pw); 
		
		Assert.assertEquals(this.objetos2.mejorPuntuacionDeUnTP(pw), 10); 
	}
	
	public void testMejorPuntuacionDeUnTest(){
		MydTerm eval = mock (MydTerm.class); 
		this.objetos2.addTest((test.Test) eval); 
		
		when (eval.bestScoreIn()).thenReturn(8); 
		this.objetos2.mejorPuntuacionDeUnTest(eval);
	}
}
